//
//  Table.h
//
//  Created by lee jory on 09-10-22.
//  Copyright 2009 Netgen. All rights reserved.
//

#import <Foundation/Foundation.h>

/**
 * Table所用数据源对象
 */
@interface TableDataSource : NSObject
{
	/**
	 * 标题列表
	 */
	NSMutableArray *titles;
	
	/**
	 * 数据体，其中包函其它列表(NSArray)
	 */
	NSMutableArray *data;
	
	/**
	 * 列宽
	 */
	NSMutableArray *columnWidth;
	
	//标题背景颜色
	int iHeaderBgColor;
	//标题字体颜色
	int iHeaderFontColor;
	//水平对齐方式
	int iHorizontal;
}

@property(nonatomic,retain) NSMutableArray *titles;
@property(nonatomic,retain) NSMutableArray *data;
@property(nonatomic,retain) NSMutableArray *columnWidth;
@property(nonatomic) int iHeaderBgColor;
@property(nonatomic) int iHeaderFontColor;
@property(nonatomic) int iHorizontal;

@end

@interface TableScrollView : UIScrollView
{
	id iTable;
}
@property(assign)id iTable;
@end


/**
 * 数据列表组件，支持上下与左右滑动
 */
@interface Table : UIView<UIScrollViewDelegate> {
	
	//左下列视图
	TableScrollView *vLeft;

	//右下列视图
	TableScrollView *vRight;

	//右下列表内容
	UIView *vRightContent;
	
	//左下列表内容
	UIView *vLeftContent;
	
	//右上标题
	UIView *vTopRight;
	
	//左上标题
	UIView *vTopLeft;
	
	//列表数据源
	TableDataSource *dataSource;
	
	//内容总高度
	float contentHeight ;
	
	//内容总宽度
	float contentWidth;
	
	//单元格默认高度
	float cellHeight;
	
	//单元格默认宽度
	float cellWidth;
	
	int iAbsoluteY;
}

@property(readonly) TableScrollView *vRight;
@property(readonly) TableScrollView *vLeft;
@property(readonly) float cellHeight;
@property(nonatomic) int iAbsoluteY;
@property(nonatomic,retain) TableDataSource *dataSource;

/**
 * 用指定显示区域 与 数据源初始化对象
 */
- (id)initWithFrame:(CGRect)aRect data:(TableDataSource*)aDataSource;

- (NSString*) getSelectText:(int) aIndex;
- (NSString*) getSelectValue:(int) aIndex;

@end
